package 高级;

import java.util.Arrays;
import java.util.Scanner;

//2:输入字符串，计算可转换成的最大浮点数字，从左侧开始，直到非数字结束，
//        比如输入124abc,则最大是124，如果是122.44fff,则是122.44
public class Zuoye04182 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入字符串：");
        String a = scan.next();
        String z = "^[0-9]*\\.?[0-9]+";
        String[] s = a.split(z);
        String n = a.replaceAll(z, "");
        String n2 = a.replace(n, "");
        try {
            int d = Integer.parseInt(n2);
            System.out.println(d);
        } catch (Exception e) {
            double d = Double.parseDouble(n2);
            System.out.println(d);
        }
    }


}
